
// 正则表达式判断为6位数的数字
const passwordRegex = new RegExp('^[0-9]{6,6}$');

function submit() {
    const tipDom = document.querySelector('.tip');

    const arr = document.getElementsByClassName('my-input');
    const user = arr[0].value;
    if( !user ){
        tipDom.innerHTML = '请输入账号！';
        return;
    }
    const password = arr[1].value;
    if( !password ){
        tipDom.innerHTML = '请输入密码！';
        return;
    }
    // if( user !== 'admin' || password !== '123456'  ){
    //     tipDom.innerHTML = '账号或密码错误！';
    //     return;
    // }
    tipDom.innerHTML = '登录成功！';
    setTimeout(() => {
        arr[0].value = '';
        localStorage.setItem('USER_INFO', JSON.stringify({
            name: user,
        }));
        window.location = 'index.html'
    }, 500);
}
console.log(passwordRegex.test('12345'));